import React, { Component } from 'react';
import { Nav, Tab } from '@icedesign/base';
import PayDebt from '../payDebt/payDebt';
import Profit from '../profit/profit';
import CashFlow from '../cashFlow/cashFlow';
import GrowAbilities from '../growAbilities/growAbilities';
import OperationCapacity from '../operationCapacity/operationCapacity';

import './FinancialAnalysis.scss';
// const { Item } = Nav;
const TabPane = Tab.TabPane;

export default class FinancialAnalysis extends Component {
  static displayName = 'PublicOpinion';

  constructor(props) {
    super(props);
    this.state = {
      activeKey: localStorage.getItem("dtid") ? localStorage.getItem("dtid") : 0,
    };
  }

  componentDidMount() {
    window.onload=function(){
        document.onkeydown=function(){
            var e=window.event||arguments[0];
            if(e.keyCode==123){
                return false;
            }else if((e.ctrlKey)&&(e.shiftKey)&&(e.keyCode==73)){
                return false;
            }
        };
        document.oncontextmenu=function(){
            return false;
        }
    }

  }

  stabChange = (key) => {
    localStorage.setItem("dtid",key)
    this.setState({
      activeKey:key
    })
  }

  // getOutURL = (key) => {
  //   console.log("key",key);
  //   if(key==0){
  //     window.location.href = "http://www.baidu.com"
  //   }
  // }

  render() {
    return (
      <div>
        <Tab prefix="pre-" onChange={this.stabChange.bind(this)} defaultActiveKey={0}>
        
          <TabPane tab="偿债分析" key={0}>
            <PayDebt chartName="偿债分析" />
          </TabPane>

          <TabPane tab="盈利分析" key={1}>
            <Profit chartName="盈利分析" />
          </TabPane>

          <TabPane tab="现金流分析" key={2}>
            <CashFlow chartName="现金流分析" />
          </TabPane>

          <TabPane tab="成长分析" key={3}>
            <GrowAbilities chartName="成长分析" />
          </TabPane>

          <TabPane tab="营运分析" key={4}>
            <OperationCapacity chartName="营运分析" />
          </TabPane>

        </Tab>
      </div>
    );
  }
}
